package com.deep.test

import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.mllib.linalg._
import org.apache.spark.mllib.regression.LabeledPoint
import org.apache.spark.mllib.stat.Statistics
import org.apache.spark.mllib.stat.Statistics._
/**
 * @author sw
 * @create 2023-06-02 14:03
 */
object Test09 {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local").setAppName("ALS")
    val sc = new SparkContext(conf)
    sc.setLogLevel("WARN")
    val v1: Vector = sc.textFile("data/iris.data").map(_.split(",")).map(p => Vectors.dense(p(0).toDouble, p(1).toDouble, p(2).toDouble, p(3).toDouble)).first
    val v2: Vector = sc.textFile("data/iris.data").map(_.split(",")).map(p => Vectors.dense(p(0).toDouble, p(1).toDouble, p(2).toDouble, p(3).toDouble)).take(2).last
    val goodnessOfFitTestResult = Statistics.chiSqTest(v1)
    print(goodnessOfFitTestResult)
  }
}
